<!--
 * @Descripttion: 待办提醒弹框
 * @version:
 * @Author: zhangfan
 * @email: 2207044692@qq.com
 * @Date: 2020-07-19 13:46:23
 * @LastEditors: zhangfan
 * @LastEditTime: 2021-07-09 14:22:00
-->
<template>
  <el-dialog
    title="提醒"
    :visible.sync="dialogVisible"
    width="420px"
    :before-close="handleClose"
  >
    <p v-if="waitPaySalary != '0'">
      范围内存在{{ waitPaySalary }}个【待发放】状态的工资表
      <!-- <span class="linkStyle" @click="toBeReleased('NO_ISSUE')"
        >立即查看>></span
      > -->
      <el-link
        type="primary"
        class="linkStyle"
        @click="toBeReleased('NO_ISSUE')"
        >立即查看 >></el-link
      >
    </p>
    <p style="margin-top: 6px" v-if="waitAuditAccout != '0'">
      范围内存在{{ waitAuditAccout }}个【待审核】的项目专户开设预约
      <!-- <span class="linkStyle" @click="toBookAccount('WAIT_AUDIT')"
        >立即查看>></span
      > -->
      <el-link
        type="primary"
        class="linkStyle"
        @click="toBookAccount('WAIT_AUDIT')"
        >立即查看 >></el-link
      >
    </p>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      activeNames: [],
      dialogVisible: false,
      waitPaySalary: 0,
      waitAuditAccout: 0,
      areaId: '',
    }
  },
  created() {
    this.getPendingReviewData()
    this.getAreaList()
  },
  methods: {
    getAreaList() {
      this.axios({
        method: 'post',
        data: {
          areaId: this.$store.state.areaInfoArr.areaId,
        },
        url: 'api-bs/areadic/base/detailbyareaid',
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              this.areaId = response.data.result[0].value
            } else {
            }
          },
          (response) => {}
        )
        .catch((error) => {})
    },
    toBookAccount(type) {
      this.$router.push({
        path: '/home/oneCode/bookAccount',
        name: 'bookAccount',
        query: {
          status: type,
        },
      })
      this.dialogVisible = false
    },
    toBeReleased(type) {
      this.$router.push({
        path: '/home/salaryDf/salaryPayListTab',
        name: 'salaryPayListTab',
        query: {
          status: type,
          tab: 'payrollList',
          areaId: this.areaId,
        },
      })
      this.dialogVisible = false
    },
    /**
     * @description: 待审核数据获取
     */
    getPendingReviewData() {
      this.axios({
        method: 'post',
        url: 'api-h/homepage/expand/bankdetail',
      })
        .then(
          (res) => {
            if (!res.data.hasError) {
              this.waitPaySalary = res.data.result.waitPaySalary
              this.waitAuditAccout = res.data.result.waitAuditAccout
              if (
                res.data.result.waitPaySalary != '0' ||
                res.data.result.waitAuditAccout != '0'
              ) {
                this.dialogVisible = true
              } else {
                this.dialogVisible = false
              }
            } else {
              this.$message.error('待审核数据获取失败')
            }
          },
          (res) => {
            this.$message.error('待审核数据获取失败')
          }
        )
        .catch((error) => {})
    },
  },
}
</script>

<style scoped lang="less">
.linkStyle {
  // cursor: pointer;
  // color: #057cf7;
  margin-left: 10px;
}
</style>
